package com.xmy.cultivate.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmy.cultivate.entity.Organization;
import com.xmy.cultivate.mapper.OrganizationMapper;
import com.xmy.cultivate.service.IOrganizationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 组织机构 服务实现类
 * </p>
 *
 * @author hpiggy
 * @since 2024-03-20
 */
@Service
public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Organization> implements IOrganizationService {

    @Autowired
    OrganizationMapper organizationMapper;

    @Override
    public Organization getOneForAliAccount(String aliAccount){

        QueryWrapper<Organization> organizationQueryWrapper = new QueryWrapper<>();
        organizationQueryWrapper.eq("ali_account",aliAccount);
        organizationQueryWrapper.eq("status",1);
        organizationQueryWrapper.last("limit 1");
        Organization organization = organizationMapper.selectOne(organizationQueryWrapper);
        return organization;
    }
}
